package processors;

import java.awt.image.renderable.ParameterBlock;

import javax.media.jai.JAI;
import javax.media.jai.PlanarImage;

public class ThresholdProcessor extends Processor<PlanarImage, PlanarImage>{
	
    private double low;
    private double high;
    private double map;

    public ThresholdProcessor(double low, double high, double map) {
        this.low = low;
        this.high = high;
        this.map = map;
    }

    @Override
    public void process(PlanarImage image) {

        double[] low = {this.low};
        double[] high = {this.high};
        double[] map = {this.map};

        ParameterBlock pb = new ParameterBlock();
        pb.addSource(image);
        pb.add(low);
        pb.add(high);
        pb.add(map);
        setOutput(JAI.create("threshold", pb));
    }

}
